package com.example.tys.daggermvp.utils;

/**
 * 单例帮助类
 *
 * @author tys
 * @date 2018/4/22
 */

public abstract class Singleton<T> {
    private T mInstance;

    public abstract T createdInstance();

    public T get() {
        if (mInstance == null) {
            synchronized (this) {
                if (mInstance == null) {
                    mInstance = createdInstance();
                }
            }
        }
        return mInstance;
    }
}
